<% layout('/layouts/default.html', {title: '文件分发管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('文件分发记录')}
			</div>
		</div>
		<div class="box-body">

			<div class="row mb10">
				<div class="col-xs-12" style="margin-left: -5px;">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							${text('来文标题')}：</label>
						<div class="col-sm-10">
							<input readonly class="form-control width-460" value="${docRecv.docTitle}" />
						</div>
					</div>
				</div>

			</div>
			<div class="row mb10">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							${text('来文文号')}：</label>
						<div class="col-sm-8">
							<input readonly class="form-control width-260" value="${docRecv.docFullNum}" />
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							${text('来文自编号')}：</label>
						<div class="col-sm-8">
							<input  readonly="true"  class="form-control width-260" value="${docRecv.docSysCode}"/>
						</div>
					</div>

				</div>
			</div>
			<div class="row mb10">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							${text('来文时间')}：</label>
						<div class="col-sm-8">
							<#form:input value="${docRecv.docRecvDate}" readonly="true" maxlength="20" class="form-control width-260"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							${text('文件密级')}：</label>
						<div class="col-sm-8">
							<input id="security" readonly="true"  class="form-control width-120" value=""/>
						</div>
					</div>
				</div>
			</div>
			<#form:form id="searchForm" model="${docDeliverRecord}" action="${ctx}/sd/docDeliverTake/listData?docId=${docDeliverRecord.docId}" method="post" class="form-inline hide"
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">

		</#form:form>
		<table id="dataGrid"></table>
		<div id="dataGridPage"></div>
	</div>
</div>
</div>
<% } %>
<script>

	$("#security").val(js.getDictLabel(${@DictUtils.getDictListJson('recv_sec_lvl')}, ${docRecv.secLvl}, '${text("未知")}', true));
	// 初始化DataGrid对象
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		columnModel: [
				//D:\CustomUploadPicture\1595236773838.png
			{header:'${text("领文人姓名")}', name:'takeUserName', index:'take_user_name', width:150, align:"center"},
			{header:'${text("领文人警号")}', name:'takeUserPoliceno', index:'take_user_policeno', width:150, align:"center"},
			{header:'${text("领文人人脸")}', name:'takeUserFace', index:'take_user_face', width:150, align:"center",formatter: function(val, obj, row, act){
				if(val==null){
					return "暂无图片";
				}else {
					//var src = val.replace(/\\/g,"\/");
					//return src;
					return '<a href="#" class=""   title="点击查看人脸" onclick="showImg(\''+val+'\')"><i class="fa fa-image (alias)"></i></a>';
				}
				}},
			{header:'${text("还文人姓名")}', name:'returnUserName', index:'return_user_name', width:150, align:"center"},
			{header:'${text("还文人警号")}', name:'returnUserPoliceno', index:'return_user_policeno', width:150, align:"center"},
			{header:'${text("还文人人脸")}', name:'returnUserFace', index:'return_user_face', width:150, align:"center",formatter: function(val, obj, row, act){
					if(val==null){
						return "暂无图片";
					}else {
						//var src = val.replace(/\\/g,"\/");
						return '<a href="#" class=""   title="点击查看人脸" onclick="showImg(\''+val+'\')"><i class="fa  fa-image (alias)"></i></a>';
					}
				}},
			{header:'${text("文件分发编号")}', name:'docCopyNo', index:'doc_copy_no', width:150, align:"center"},
			{header:'${text("文件领取状态")}', name:'docCopyNo', index:'doc_copy_no', width:150, align:"center",formatter: function(val, obj, row, act){
					if(row.takeDate==null){
						return "<a style='color: #ff0000'>未领</a>";
					}else if(row.returnDate==null){
						return "<a style='color: #efac07'>待还</a>";
					}else {
						return "<a style='color: #008000'>已还</a>";
					}

				}},
			{header:'${text("单位类型")}', name:'deliverType', index:'deliver_type', width:150, align:"center",formatter: function(val, obj, row, act){
					if(row.deliverType=='2'){
						return "<a style='color: #1d1c1c'>领文</a>";
					}else{
						return "<a style='color: #ff0048'>送文</a>";
					}

				}},
			{header:'${text("领文单位")}', name:'office.officeName', index:'o.office_name', width:150, align:"center"},
			{header:'${text("领文单位柜号")}', name:'office.extend.extendS4', index:'o.extend_s4', width:150, align:"center"},

		],
		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});

	function showImg1(obj) {
		console.log(obj)
		var img = new Image();
		img.src = obj;
		var height = img.height; //获取图片高度
		var width = img.width; //获取图片宽度
		var imgHtml = "<img src='" + obj + "' />";
		//onerror="this.src='${ctxStatic}/error.jpg'
		//弹出层
		layer.open({
			type: 1,
			shade: 0.8,
			offset: 'auto',
			area: [width + 'px',height+'px'],
			shadeClose:true,//点击外围关闭弹窗
			scrollbar: false,//不现实滚动条
			title: "", //不显示标题
			content: imgHtml, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
			cancel: function () {
				//layer.msg('捕获就是从页面已经存在的元素上，包裹layer的结构', { time: 5000, icon: 6 });
			}
		});
	}

	//查看人脸图像
function showImg(src) {
	js.layer.open({
		type: 2,
		shade: 0.8,
		//area: [(js.layer.window.outerWidth-900)+'px',(js.layer.window.outerHeight-220)+'px'],
		area:  ['555px', '505px'],
		title: '',
		resize: false,
		scrollbar: false,
		maxmin:false,
		content: '${ctx}/sd/collectPicture/showImg?src='+src,
		success: function(layero, index){
		},


	});
}
</script>